@use '../../app.scss' as *;

.nutui-react-demo {
  overflow-y: auto;
  background-color: #f5f5f7;
  padding: .75rem 1rem;
  padding-bottom: 100px;

  .welcome-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;

    .welcome-info-left {
      display: flex;
      flex-direction: column;

      .welcome-name {
        font-size: 1.25rem;
        font-weight: bold;
        margin-bottom: 0.25rem;
      }

      .welcome-date {
        font-size: 0.875rem;
        color: #666;
      }
    }

    .avatar {
      width: 2.5rem;
      height: 2.5rem;
      border-radius: 9999px;
      background-color: #3b82f6;
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;

      text {
        font-weight: bold;
      }
    }
  }

  .task-card {
    @include card;
    padding: 1rem;
    margin-bottom: 1rem;

    .card-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 0.75rem;

      .card-title {
        font-weight: 600;
        font-size: 1rem;
      }

      .card-action {
        color: #3b82f6;
        font-size: 0.875rem;
      }
    }

    .stats-container {
      display: flex;
      margin-bottom: 0.75rem;
      gap: 0.75rem;

      .stat-card {
        flex: 1;
        background-color: #eff6ff;
        border-radius: 0.5rem;
        padding: 0.75rem;

        .stat-label {
          font-size: 0.75rem;
          color: #6b7280;
          margin-bottom: 0.25rem;
        }

        .stat-value-container {
          display: flex;
          align-items: flex-end;

          .stat-value {
            font-size: 1.25rem;
            font-weight: 700;
          }

          .stat-change {
            font-size: 0.75rem;
            color: #10b981;
            margin-left: 0.25rem;
          }
        }
      }
    }

    .progress-bar-container {
      width: 100%;
      background-color: #e5e7eb;
      border-radius: 9999px;
      height: 0.625rem;
      margin-bottom: 0.25rem;

      .progress-bar {
        background-color: #3b82f6;
        height: 0.625rem;
        border-radius: 9999px;
      }
    }

    .progress-text {
      font-size: 0.75rem;
      color: #6b7280;
      margin-bottom: 0.5rem;
    }
  }

  .chart-card {
    @include card;
    padding: 1rem;
    margin-bottom: 1rem;

    .chart-header {
      display: flex;
      justify-content: space-between;
      align-items: center;

      .chart-title {
        font-weight: 600;
        font-size: 1rem;
      }

      .tab-group {
        display: flex;
        gap: 0.5rem;

        .tab {
          font-size: 0.75rem;
          padding: 0.25rem 0.5rem;
          border-radius: 9999px;

          &.active {
            background-color: #3b82f6;
            color: white;
          }

          &.inactive {
            background-color: #e5e7eb;
            color: #6b7280;
          }
        }
      }
    }

    .chart-container {
      height: 250px;
      width: 100%;
    }
  }

  .history-card {
    @include card;
    margin-bottom: 1rem;

    .history-header {
      padding: 1rem;
      border-bottom: 1px solid #f3f4f6;

      .header-content {
        display: flex;
        justify-content: space-between;
        align-items: center;

        .header-title {
          font-weight: 600;
          font-size: 1rem;
        }

        .header-action {
          color: #3b82f6;
          font-size: 0.875rem;
        }
      }
    }

    .show-more-hint {
      padding: 1rem;
      text-align: center;
      color: #6b7280;
      font-size: 0.75rem;
    }
    

    .history-item {
      @include list-item;

      &:last-child {
        border-bottom: none;
      }

      .item-icon {
        margin-right: 0.75rem;
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 9999px;
        display: flex;
        align-items: center;
        justify-content: center;

        &.completed {
          background-color: #d1fae5;

          i {
            color: #10b981;
          }
        }

        &.not-started {
          background: #e9e9e9;
          i {
            color: #64748b;
          }
        }
        
        &.ended {
          background: #e9e9e9;
          i {
            color: #64748b;
          }
        }

        &.in-progress {
          background-color: #f0f5ff;

          i {
            color: #5c9dff;
          }
        }

        &.overdue {
          background: #fee2e2;
          i {
            color: #b91c1c;
          }
        }
      }

      .item-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        max-width: 60%;

        .item-title {
          font-weight: 500;
          // 不换行
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }

        .item-subtitle {
          font-size: 0.75rem;
          color: #6b7280;
          margin-top: 0.25rem;
        }
      }

      .item-status {
        margin-left: 0.5rem;

        .status-badge {
          font-size: 0.75rem;
          padding: 0.25rem 0.5rem;
          border-radius: 9999px;

          &.completed {
            background-color: #d1fae5;
            color: #047857;
          }

          &.not-started {
            background: #e9e9e9;
            color: #64748b;
          }

          &.ended {
            background: #e9e9e9;
            color: #64748b;
          }

          &.in-progress {
            background-color:#f0f5ff;
            color: #5c9dff;
          }

          // 红色
          &.overdue {
            background: #fee2e2;
            color: #b91c1c;
          }
          
        }
      }
    }
  }

  .risk-student-card {
    @include card;
    margin-bottom: 1rem;
    overflow: hidden;

    .risk-header {
      padding: 1rem;
      border-bottom: 1px solid #f1f1f1;

      .header-content {
        display: flex;
        justify-content: space-between;
        align-items: center;

        .header-title {
          font-weight: 600;
          font-size: 1rem;
        }

        .header-action {
          color: #3b82f6;
          font-size: 0.875rem;
        }
      }
    }

    .risk-item {
      display: flex;
      align-items: center;
      padding: 1rem;
      border-bottom: 1px solid #f1f1f1;

      &:last-child {
        border-bottom: none;
      }

      .avatar {
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 9999px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 0.75rem;

        &.high-risk {
          background-color: #fee2e2;
        }

        &.medium-risk {
          background-color: #fffbeb;
        }

        .avatar-text {
          font-weight: 600;
          font-size: 0.875rem;
        }
      }

      .student-content {
        flex: 1;
        overflow: hidden;

        .student-name {
          font-weight: 500;
          font-size: 0.875rem;
          margin-bottom: 0.25rem;
        }

        .student-detail {
          font-size: 0.75rem;
          color: #6b7280;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 1;
          -webkit-box-orient: vertical;
        }
      }

      .status-container {
        margin-left: 0.5rem;

        .risk-badge {
          display: flex;
          align-items: center;
          font-size: 0.75rem;
          padding: 0.25rem 0.5rem;
          border-radius: 9999px;

          &.high-risk {
            background-color: #fee2e2;
            color: #b91c1c;
          }

          &.medium-risk {
            background-color: #fffbeb;
            color: #b45309;
          }

          .status-dot {
            width: 0.5rem;
            height: 0.5rem;
            border-radius: 9999px;
            margin-right: 0.25rem;

            &.high-risk {
              background-color: #ef4444;
            }

            &.medium-risk {
              background-color: #f59e0b;
            }
          }
        }
      }
    }
  }

  .quick-actions-card {
    @include card;
    padding: 1rem;
    margin-bottom: 1.5rem;

    .section-title {
      font-weight: 600;
      font-size: 1rem;
      margin-bottom: 0.75rem;
      display: block;
    }

    .actions-grid {
      display: flex;
      gap: 0.75rem;

      .action-item {
        flex: 1;
        background-color: #eff6ff;
        border-radius: 0.75rem;
        padding: 0.75rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;

        &.blue {
          background-color: #eff6ff;
        }

        &.green {
          background-color: #ecfdf5;
        }

        &.purple {
          background-color: #f5f3ff;
        }

        .action-icon-wrapper {
          width: 2.5rem;
          height: 2.5rem;
          border-radius: 9999px;
          display: flex;
          align-items: center;
          justify-content: center;
          margin-bottom: 0.5rem;

          &.blue {
            background-color: #dbeafe;
          }

          &.green {
            background-color: #d1fae5;
          }

          &.purple {
            background-color: #ede9fe;
          }
        }

        .action-name {
          font-size: 0.75rem;
          color: #4b5563;
        }
      }
    }
  }
}